package com.briup.security.util;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.awt.image.BufferedImage;
import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

@Data
@AllArgsConstructor
public class ImageCode {
    /**
     * 图片
     */
    private BufferedImage image;

    /**
     * 验证码
     */
    private String code;
    /**
     * 验证码过期时间
     */
    private LocalDateTime expireTime;


    /**
     *
     * @param image 图片
     * @param code 验证阿门
     * @param expireIn 过期时间 单位为 秒
     */
    public ImageCode(BufferedImage image, String code, int expireIn) {
        this.image = image;
        this.code = code;
        this.expireTime = LocalDateTime.now().plusSeconds(expireIn);
    }

}
